;;; li.el --- Use howdoi program to search Stackoverflow for the selected text

(defun li/howdoi ()
  "howdoi query from mini buffer"
  (interactive)
  (async-shell-command (format "howdoi -c  %s"
                               (read-from-minibuffer "howdoi: "))
                       "*howdoi*" nil)
  (with-current-buffer "*howdoi*"
    (shrink-window-if-larger-than-buffer (get-buffer-window "*howdoi*"))
    (evil-force-normal-state)))

(defun li/howdoI ()
  "howdoi query from mini buffer"
  (interactive)
  (if (equal current-prefix-arg '(4))
      (setq current-prefix-arg "2"))

  (async-shell-command (format "howdoi -c  -n 3 -p %s %s"
                               (or current-prefix-arg "1")
                               (read-from-minibuffer "howdoi: "))
                       "*howdoi*" nil)
  (with-current-buffer "*howdoi*"
    (shrink-window-if-larger-than-buffer (get-buffer-window "*howdoi*"))
    (evil-force-normal-state)))


(provide 'li)
;;; howdoi.el ends here
